<?php

namespace App\Http\Requests\Api\V1_0_0;

use Illuminate\Foundation\Http\FormRequest;

class UserForgetPayPasswordRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'mobile' => 'required|regex:/^1[34578]{1}\d{9}$/',
            'password'=>'required|min:6|max:6|confirmed',
            'password_confirmation' => 'required|min:6',
            'verification_code' => 'required|min:4|max:4|regex:/^([0-9]+$)/',
        ];
    }

    public function messages()
    {
        return [
            'mobile.required' => '手机号码不能为空',
            'mobile.regex' => '手机号码格式不正确',
            'password.required'=>'密码不能为空',
            'password.min'=>'密码至少6位',
            'password.max'=>'密码最多6位',
            'password.confirmed'=>'两次输入的密码不一致',
            'password_confirmation.required' => '重复密码不能为空',
            'password_confirmation.min' => '重复密码至少6位',
            'verification_code.required' => '验证码不能为空',
            'verification_code.min' => '验证码至少4位',
            'verification_code.max' => '验证码不能大于4位',
            'verification_code.regex' => '验证码必须是4位纯数字'
        ];
    }
}
